package com.whsr.readservice.controller;

import com.whsr.readservice.service.UserService;
import com.whsr.readservice.vo.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/user/")
public class UserController {

    private final UserService userService;

    @Autowired
    public UserController(UserService userService) {
        this.userService = userService;
    }

    @RequestMapping("allUser")
    @ResponseBody
    public Object allUser(){
        List<UserInfo> users = userService.findAllUser();
        return users.toString();
    }

}
